package service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import entity.Catelog;
import entity.CatelogExample;
import entity.CatelogExample.Criteria;

import dao.CatelogMapper;

@Service
public class CatelogServiceImpl implements CatelogService{
	@Autowired
	CatelogMapper catelogMapper;
	
	@Override
	public List<Catelog> All() {
		CatelogExample example=new CatelogExample();
		example.setOrderByClause("gid desc");
		return catelogMapper.selectByExample(example);
	}

	@Override
	public Catelog findItemById(Integer gid) {
		return catelogMapper.selectByPrimaryKey(gid);
	}

	@Override
	public Catelog updateCatelog(Catelog catelog) {
		catelogMapper.updateByPrimaryKeySelective(catelog);
		return catelog;
	}

	@Override
	public int deleteBygid(Integer gid) {
		return catelogMapper.deleteByPrimaryKey(gid);
	}

	@Override
	public Catelog insertCatelog(Catelog catelog) {
		catelogMapper.insert(catelog);
		return catelog;
	}
	
}
